
package com.kunbo.cn.util.retu;

import java.util.List;
import java.util.Map;

/**
 *
 * @author bjl  
 * @date 2019年4月11日 
 */
public class BuildBean1 {

	@SuppressWarnings("hiding")
	public static <T> ResultBean1<T> buildResult (ResultBean1<T> result,String scode,String fcode,T object) {
		//public static <T> ResultBean1<T> buildResult (ResultBean1<T> result,String scode,String fcode,int total,T object) {
		if(null!=object) {
			result.setCode(0);
			result.setMsg(scode);
			result.setData(object);
			//result.setTotal(total);
			
			
		}else {
			result.setCode(1);
			result.setMsg(fcode);
			result.setData(null);
			//result.setTotal(0);
		}
		return result;
	}
	
	@SuppressWarnings("hiding")
	public static <T> ResultBean1<T> buildResults (ResultBean1<T> result,String scode,String fcode,Boolean object) {
		if(object) {
			result.setMsg(scode);
			result.setData(null);
		}else {
			result.setMsg(fcode);
			result.setData(null);
		}
		return result;
	}
	
	//public static ResultBean1<Pages> buildResulttoPages(ResultBean1<Pages> result, String scode, String fcode, Integer total,Pages data) {
	public static ResultBean1<Pages> buildResulttoPages(ResultBean1<Pages> result, String scode, String fcode, Pages data) {
		if(null!=data) {
			result.setCode(0);
			result.setMsg(scode);
			result.setData(data);
		//	result.setTotal(total);;
		}else {
			result.setCode(1);
			result.setMsg(fcode);
			result.setData(null);
			//result.setTotal(0);
		}
		return result;
	}
}
